/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 */
#include "MapDbc.h"
#include "NativeFile.h"
#include "WOWArchive.h"

namespace PQGame
{
	const std::string MapDbc::PATH="DBFilesClient\\Map.dbc";

	MapDbc::MapDbc()
	{
		MPQFile* f= SWOWArchive.openMPQFile(PATH);

		_dbc=new WOWDbcFile(f);
		delete f;
		init();
	}

	void MapDbc::init()
	{
		int cnt=_dbc->getRecordCount();
		for(int i=0;i<cnt;i++){
			MapInfo info;
			info.Id=_dbc->getIntField(i,0);
			info.Name=_dbc->getStringField(i,1);
			info.Description=_dbc->getStringField(i,3);
			if(info.Description==""){
				info.Description=info.Name;
			}
			if (!info.Name.find("Transport") || !info.Name.find("Test") || !info.Name.find("test")){
				continue;
			}
			if (info.Name == "ScottTest" || info.Name == "ExteriorTest" || info.Name == "QA_DVD" || info.Name == "CraigTest" || info.Name == "development_nonweighted" || info.Name == "development"){
				continue;
			}
			_infos.push_back(info);
		}
	}

}
